<template>
  <div>
      <el-table :data="memberlist" height="250" border style="width: 100%">
          <el-table-column prop="id" label="用户编号" width="180">
          </el-table-column>
          <el-table-column prop="nickname" label="昵称" width="180">
          </el-table-column>
          <el-table-column prop="phone" label="手机号" width="180">
          </el-table-column>
          <el-table-column label="状态">
              <template slot-scope="item">
                  <div>
                      <el-tag type="success" v-if="item.row.status">启用</el-tag>
                      <el-tag type="danger" v-else>禁用</el-tag>
                  </div>
              </template>
          </el-table-column>
          <el-table-column label="操作">
              <template slot-scope="item">
                  <div>
                      <el-button  type="primary" @click="edit(item.row.uid)" plain size="small">编辑</el-button>
                      <!-- <el-button @click="del(item.row.id)" type="text" size="small">删除</el-button> -->
                  </div>
              </template>
          </el-table-column>
      </el-table>
  </div>
</template>

<script>
// 引入辅助性函数
import { mapGetters, mapActions } from 'vuex';
export default {
  data() {
      return {

      }
  },
  mounted() {
      // 页面一加载就触发行动
      this.getMember()
  },
  computed: {
      ...mapGetters({
          memberlist: 'member/getMemberList',
      })
  },
  methods: {
      // 辅助性函数
      ...mapActions({
          getMember: 'member/changeMemberAction',
      }),
      // 编辑
      edit(uid) {
          this.$emit('edit', uid)
      },
  }
};
</script>

<style scoped>
</style>
